package dao.pojo;

import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CommodityInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "commodity_info", catalog = "onlinemall")
public class CommodityInfo implements java.io.Serializable {

	// Fields

	private Integer commodityId;
	private CommodityCategory commodityCategory;
	private PurchaseInfo purchaseInfo;
	private String commodityName;
	private String commodityIndr;
	private String commodityImage;
	private Float commodityPrice;
	private Integer commoditySales;
	private Short saleObject;
	private Short saleStatus;
	private Integer commodityScore;
	private Timestamp shelfTime;
	private Set<ShelfCommodityInfo> shelfCommodityInfos = new HashSet<ShelfCommodityInfo>(
			0);

	// Constructors

	/** default constructor */
	public CommodityInfo() {
	}

	/** minimal constructor */
	public CommodityInfo(Integer commodityId,
			CommodityCategory commodityCategory, PurchaseInfo purchaseInfo,
			String commodityName, String commodityImage, Float commodityPrice,
			Integer commoditySales, Short saleObject, Short saleStatus,
			Integer commodityScore, Timestamp shelfTime) {
		this.commodityId = commodityId;
		this.commodityCategory = commodityCategory;
		this.purchaseInfo = purchaseInfo;
		this.commodityName = commodityName;
		this.commodityImage = commodityImage;
		this.commodityPrice = commodityPrice;
		this.commoditySales = commoditySales;
		this.saleObject = saleObject;
		this.saleStatus = saleStatus;
		this.commodityScore = commodityScore;
		this.shelfTime = shelfTime;
	}

	/** full constructor */
	public CommodityInfo(Integer commodityId,
			CommodityCategory commodityCategory, PurchaseInfo purchaseInfo,
			String commodityName, String commodityIndr, String commodityImage,
			Float commodityPrice, Integer commoditySales, Short saleObject,
			Short saleStatus, Integer commodityScore, Timestamp shelfTime,
			Set<ShelfCommodityInfo> shelfCommodityInfos) {
		this.commodityId = commodityId;
		this.commodityCategory = commodityCategory;
		this.purchaseInfo = purchaseInfo;
		this.commodityName = commodityName;
		this.commodityIndr = commodityIndr;
		this.commodityImage = commodityImage;
		this.commodityPrice = commodityPrice;
		this.commoditySales = commoditySales;
		this.saleObject = saleObject;
		this.saleStatus = saleStatus;
		this.commodityScore = commodityScore;
		this.shelfTime = shelfTime;
		this.shelfCommodityInfos = shelfCommodityInfos;
	}

	// Property accessors
	@Id
	@Column(name = "commodity_id", unique = true, nullable = false)
	public Integer getCommodityId() {
		return this.commodityId;
	}

	public void setCommodityId(Integer commodityId) {
		this.commodityId = commodityId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "commodity_category_id", nullable = false)
	public CommodityCategory getCommodityCategory() {
		return this.commodityCategory;
	}

	public void setCommodityCategory(CommodityCategory commodityCategory) {
		this.commodityCategory = commodityCategory;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "purchase_id", nullable = false)
	public PurchaseInfo getPurchaseInfo() {
		return this.purchaseInfo;
	}

	public void setPurchaseInfo(PurchaseInfo purchaseInfo) {
		this.purchaseInfo = purchaseInfo;
	}

	@Column(name = "commodity_name", nullable = false, length = 100)
	public String getCommodityName() {
		return this.commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	@Column(name = "commodity_indr", length = 200)
	public String getCommodityIndr() {
		return this.commodityIndr;
	}

	public void setCommodityIndr(String commodityIndr) {
		this.commodityIndr = commodityIndr;
	}

	@Column(name = "commodity_image", nullable = false, length = 100)
	public String getCommodityImage() {
		return this.commodityImage;
	}

	public void setCommodityImage(String commodityImage) {
		this.commodityImage = commodityImage;
	}

	@Column(name = "commodity_price", nullable = false, precision = 12, scale = 0)
	public Float getCommodityPrice() {
		return this.commodityPrice;
	}

	public void setCommodityPrice(Float commodityPrice) {
		this.commodityPrice = commodityPrice;
	}

	@Column(name = "commodity_sales", nullable = false)
	public Integer getCommoditySales() {
		return this.commoditySales;
	}

	public void setCommoditySales(Integer commoditySales) {
		this.commoditySales = commoditySales;
	}

	@Column(name = "sale_object", nullable = false)
	public Short getSaleObject() {
		return this.saleObject;
	}

	public void setSaleObject(Short saleObject) {
		this.saleObject = saleObject;
	}

	@Column(name = "sale_status", nullable = false)
	public Short getSaleStatus() {
		return this.saleStatus;
	}

	public void setSaleStatus(Short saleStatus) {
		this.saleStatus = saleStatus;
	}

	@Column(name = "commodity_score", nullable = false)
	public Integer getCommodityScore() {
		return this.commodityScore;
	}

	public void setCommodityScore(Integer commodityScore) {
		this.commodityScore = commodityScore;
	}

	@Column(name = "shelf_time", nullable = false, length = 19)
	public Timestamp getShelfTime() {
		return this.shelfTime;
	}

	public void setShelfTime(Timestamp shelfTime) {
		this.shelfTime = shelfTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "commodityInfo")
	public Set<ShelfCommodityInfo> getShelfCommodityInfos() {
		return this.shelfCommodityInfos;
	}

	public void setShelfCommodityInfos(
			Set<ShelfCommodityInfo> shelfCommodityInfos) {
		this.shelfCommodityInfos = shelfCommodityInfos;
	}

}